package datasv.studentQuery_datasv;

import data.datafactory.DatabaseOperator;
import resultmessage.StudentQueryRM;

public class DeleteStudent {
	public static void main(String[] args) {
		System.out.println(new DeleteStudent().deleteStudent("001131011"));
	}
	public StudentQueryRM deleteStudent(String id){
		return deleteInSql(id);
	}
	private StudentQueryRM deleteInSql(String id){
		DatabaseOperator op=new DatabaseOperator("college"+id.substring(0,3));
		if(!op.ifDatabaseExist()||!op.ifIDExist("student_list", id)){
			return StudentQueryRM.STUDENT_NOT_EXIST;
		}
		if(op.deleteOneRow(id, "student_list")){
			return StudentQueryRM.SUCCESS;
		}
		return StudentQueryRM.STUDENT_NOT_EXIST;
	}
}
